<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<meta name="viewport" content="width=device-width; initial-scale=1.0" />	
	<link rel="stylesheet" href="__RES__/common/base.css" />
	<link rel="stylesheet" href="__RES__/member/css/reg.css" />
</head>
<style>
	#pay_list{
		margin:10px 0 20px 10px;
	}
	#pay_list li{
		line-height:30px;
	}
	#pay{
		color: #fff;
		cursor: pointer;
		display: block;
		font-family: 微软雅黑;
		font-size: 14px;
		font-weight: bold;
		height: 28px;
		line-height:25px;
		background:#ff481b;
		border:1px solid #f60;
		width: 80px;
		margin-top:10px;
	}
</style>
<body style="width:200px;">		
	<div id="pay_list">
		<h2>选择支付方式</h2>		
		<ul>
			{volist name="list" id="pay"}
			<li>
				<label>
					<input name="code" {if condition="$pay['code'] eq 'alipay' "} checked="checked" {/if}  value="{$pay.code}" type="radio" /> {$pay.name}
				</label>
			</li>
			{/volist}
		</ul>		
		<button id="pay">支付</button>
	</div>
</body>
<script src="__PUBLIC__/js/jquery/jquery-2.1.4.min.js"></script>
<script src="__PUBLIC__/js/jquery/jquery-migrate-1.2.1.min.js"></script>

<script>
$('#pay').click(function(){
		
var type=$("input[name='code']:checked").val();		

$.post(
	"{:url('payment/Payment/re_pay')}",
	{
		type:type				
	},
	function(d){
		if(d.error){
			//alert(d.error);
			parent.window.art.dialog({content:d.error, lock: true});
		}else if(d.pay_url){
			
			if(d.type=='wx_pay'){
					window.location.href=d.pay_url;
				}else{
					parent.window.location.href=d.pay_url;
				}
			}
		}	
	);
	
});

</script>

</script>
</html>